﻿using System.Collections.Generic;

namespace Yz.Base.Config
{
    public class BaseUploadConfig
    {
        /// <summary>
        /// 单文件上传地址
        /// </summary>
        public string UploadUrl { get; set; }
        /// <summary>
        /// 后台上传前缀地址
        /// </summary>
        public string ServerUrl { get; set; }
        /// <summary>
        /// 分片文件上传地址
        /// </summary>
        public string UploadChunkUrl { get; set; }
        /// <summary>
        /// 上传文件的虚拟根目录
        /// </summary>
        public string VirtualPath { get; set; }
        /// <summary>
        /// 文件合并地址
        /// </summary>
        public string MergeUrl { get; set; }
        /// <summary>
        /// 文件删除地址
        /// </summary>
        public string DeleteUrl { get; set; }
        /// <summary>
        /// 下载文件的地址
        /// </summary>
        public string DownloadUrl { get; set; }
        /// <summary>
        /// 文档预览地址
        /// </summary>
        public string PreviewUrl { get; set; }
        /// <summary>
        /// 文件复制地址
        /// </summary>
        public string CopyUrl { get; set; }
        /// <summary>
        /// 下载远程文件的地址
        /// </summary>
        public string RemoteDownloadUrl { get; set; }
        /// <summary>
        /// 上传文件的物理根目录
        /// </summary>
        public string PhysicalPath { get; set; }
        /// <summary>
        /// 增加的mime类型映射，使用;号隔开(响应类型)
        /// </summary>
        public string AppendMimes { get; set; }
        /// <summary>
        /// 缓存时间（秒）
        /// </summary>
        public long ResponseCache { get; set; }
        /// <summary>
        /// 允许跨域地址（;隔开）
        /// </summary>
        public string AllowOrigins { get; set; }
        /// <summary>
        /// 每次加载文件大小
        /// </summary>
        public int DownloadSize { get; set; }
        
        /// <summary>
        /// 各个app的配置
        /// </summary>
        public Dictionary<string, FileLimit> Limits { get; set; }
    }
    /// <summary>
    /// 文件限制
    /// </summary>
    public class FileLimit
    {
        /// <summary>
        /// 允许的文件后缀
        /// </summary>
        public string AllowExts { get; set; }
        /// <summary>
        /// 分片，单片文件大小(kb)，默认15M
        /// </summary>
        public long ChunkSize { get; set; }
        /// <summary>
        /// 单个文件大小(kb)
        /// </summary>
        public long Size { get; set; }
        /// <summary>
        /// 是否支持分片
        /// </summary>
        public bool IsChunk { get; set; }
    }

}
